﻿using System;
using System.Collections.Generic;
using IBNet.UtilsDataStructuresAndExtensions;

namespace IBNet.DayTrade
{
   /// <summary>
   /// Represents an indicator for use in algorithmic trading.
   /// </summary>
   public abstract class Indicator
   {
      private readonly string _name;

      /// <summary>
      /// Creates a new Indicator with a specified name.
      /// </summary>
      /// <param name="name">The name for the indicator.</param>
      public Indicator(string name)
      {
         _name = name;
      }

      /// <summary>
      /// Gets the name of the indicator.
      /// </summary>
      public string Name
      {
         get { return _name; }
      }

      /// <summary>
      /// Calculates the indicator on specified price bars.
      /// </summary>
      /// <param name="priceBars">The price bars to calculate the indicator on.</param>
      /// <returns>The calculated indicator value.</returns>
      public abstract decimal? CalculateIndicator(
         FixedLengthCollection<PriceBar> priceBars);
   }
}
